//# sourceURL=login.js
var layer,element,form ;
$(function(){
	layui.use(['layer','element','form'], function(){
		  layer = layui.layer;
		  element = layui.element;
		  form = layui.form;
		  $._Ajax.noParameterJPost("/sysUser/getMyInfo.json", function(res){
			  var data=res;
			   $("#username").val(data.username);
		       $("#name").val(data.name);
			   $("#number").val(data.number);
			}, function(res){});		   
		})
})
	//修改密码提交
	function changeinfofun()
	{   
		var UserName=$("#username").val();
		var Name =$("#name").val();
		var Number =$("#number").val();
		if(validate.isBlank(UserName))
		{
			layer.msg("请输入用户名！", {icon: 5});
			return false;
		}
		if(!validate.isLength(UserName,4,50)){
			layer.msg("用户名长度应在4-50个字符之间", {icon: 5});
			return false;
		}
		if(validate.isBlank(Name))
		{
			layer.msg("请输入姓名！", {icon: 5});
			return false;
		}
		if(!validate.isLength(Name,1,50)){
			layer.msg("姓名长度不能超过50个字符！", {icon: 5});
			return false;
		}
		if(validate.isBlank(Number))
		{
			layer.msg("请输入工号！", {icon: 5});
			return false;
		}
		if(!validate.isLength(Number,1,50)){
			layer.msg("工号长度不能超过50个字符！", {icon: 5});
			return false;
		}		
		var requestData ={"username":UserName,"name":Name,"number":Number};
		$._Ajax.jPost("/sysUser/updateData.json", requestData, function(res){
			  var index = parent.layer.getFrameIndex(window.name);		     
			  if(res.status == 200)
				{
				   layer.msg(res.resultMsg, {icon: res.icon});
					setInterval(function(){
						parent.layer.close(index);
					},3000)	
				}else{
					layer.msg(res.resultMsg, {icon: res.icon});
				}
			
		}, function(res){
		}, false);
	}